/*
Ext.ux.ajax.SimManager.init({
    delay: 300,
    defaultSimlet: null
}).register({
    'Numbers': {
    	data: [
               [1,'RESERVE_PERMISSION'],
               [2, 'MANAGE_FRAUD_PERMISSION'],
               [3, 'MANAGE_MERCHANT'],
               [4, 'GENERATE_ORDERNUMBER'],
               [5, 'MANAGE_WORK_AND_REST_DAY'],
               [6, 'MANAGE_SABRE_TICKET_PRINTER'],
               [7, 'EDIT_AIRPORT'],
               [8, 'SMS_MONITORING'],
               [9, 'REFUND_PERMISSION'],
               [10, 'DEPOSIT_PERMISSION']
            ],
        stype: 'json'
    }
});

var ds = Ext.create('Ext.data.ArrayStore', {
        fields: ['value','text'],
        proxy: {
            type: 'ajax',
            url: 'Numbers',
            reader: 'array'
        },
        autoLoad: true,
        sortInfo: {
            field: 'value',
            direction: 'ASC'
        }
    });
 
*/
Ext.define('AM.view.user.Edit', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.useredit',
    layout: 'fit',
    autoShow: true,
    initComponent: function() {
        this.items = [
            {
                xtype: 'form',
                id: 'editUserForm',
                items: [
					{
					    xtype: 'textfield',
					    name : 'id',
					    fieldLabel: 'Id',
					    readonly: true
					},
                    {
                        xtype: 'textfield',
                        name : 'username',
                        fieldLabel: 'User Name'
                    },
                    {
                        xtype: 'combobox',
                        name : 'merchant',
                        fieldLabel: 'Merchant',
                        displayField: 'name',
                        store: 'Merchants',
                        queryMode: 'local',
                        typeAhead: true
                    },{
                        xtype: 'combobox',
                        name : 'paymentAgent',
                        fieldLabel: 'Payment agent',
                        displayField: 'name',
                        store: 'PaymentAgents',
                        queryMode: 'local',
                    },{
                        xtype: 'combobox',
                        name : 'location',
                        fieldLabel: 'Location',
                        displayField: 'name',
                        store: 'Locations',
                        queryMode: 'local',
                    },{
                        xtype: 'checkbox',
                    	fieldLabel: 'Activity',
                        name: 'activity',
                        inputValue: 'true'
                    },{
                        xtype: 'checkbox',
                    	fieldLabel: 'Interactive user',
                        name: 'interactiveUser',
                        inputValue: 'true'
                    },{
                        xtype: 'checkbox',
                    	fieldLabel: 'Forced',
                        name: 'forced',
                        inputValue: 'true'
                    },
                    {
                        xtype: 'itemselector',
                        name: 'itemselector',
                        id: 'itemselector-field',
                        anchor: '100%',
                        fieldLabel: 'Permissions',
                        store: permissionStore,
                        displayField: 'text',
                        valueField: 'value',
                        value: [2, 4, 6],
                        allowBlank: false,
                        msgTarget: 'side',
                        fromTitle: 'Available permissions',
                        toTitle: 'Selected permissions',
                        buttons: ['add', 'remove']
                    }
                    
                ]
            }
        ];
        /*
        this.dockedItems = [{
            xtype: 'toolbar',
            dock: 'bottom',
            items: [{
                xtype: 'button',
                text: 'Close',
            }, {
                xtype:'button',
                text: 'Save'
            }]
        }];
       */ 
        this.buttons = [
            {
                text: 'Save',
                action: 'save'
            },
            {
                text: 'Cancel',
                action: 'cancel'
            }
        ];

        this.callParent(arguments);
    }
});